using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace WindowsPhoneGame3
{
    public class Item
    {
        private int loai = 0;
        private Texture2D itemTexture;
        private Vector2 position;
        private Vector2 index;
        private Vector2 size = new Vector2(116, 116);
        private int padding = 20;
        public void LoadContent(ContentManager theContent)
        {
            if (loai == 0)
            {
                itemTexture = theContent.Load<Texture2D>("images/nguoi");
            }
            else if (loai == 1)
            {
                itemTexture = theContent.Load<Texture2D>("images/nguoi1");
            }
            else
            {
                itemTexture = theContent.Load<Texture2D>("images/nguoi2");
            }
        }
        public void Draw(SpriteBatch sprite)
        {
            sprite.Draw(itemTexture, position, Color.White);
        }
        //set loai: trong, p1, p2
        public void setloai(int a)
        {
            loai = a;
        }
        public int getloai()
        {
            return loai;
        }
        public void setposition(int x, int y)
        {
            index.X = x;
            index.Y = y;
            position.X = 250 + x * (size.X + padding);
            position.Y = 46 + y * (size.Y + padding);
        }

       // kiem tra co duoc cham hay khong
        public bool isTouch(Vector2 a)
        {
            // kiem tra xem co trung toa do anh hay khong neu trung toa do anh thi true, khong thi tra ve false
            if (a.X >= position.X && a.X <= (position.X + size.X) && a.Y >= position.Y && a.Y <= (position.Y + size.Y))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
